<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>动态绑定 class属性对象语法</title>
</head>
<!--<script src="../../../../../js/vue.global.js"></script>-->
<style>
    .colordecroation {
        color: red;
    }
    .linedecoration {
        text-decoration: underline;
    }
</style>

<body>
<div id="app">
    <h1 class="colordecroation">Hello World!</h1>
<!--    对象与噶格式{类名：true}-->
    <h1 class="colordecroation" v-bind:class={linedecoration:true}>Hello World!</h1>
    <h1 v-bind:class="{colordecroation:iscolordecroatio,linedecoration:islinedecoration}">Hello World!</h1>
    <h1 v-bind:class="classStyle2">Hello World!</h1>
</div>
</body>
<script type="module">
    import  {createApp,ref,reactive} from "../../../../js/vue.esm-browser.js";

    const app = createApp({
        setup(){

            let  iscolordecroatio=ref(true)
            let  islinedecoration=ref(true)

            let classStyle1 = reactive({
                colordecroation:iscolordecroatio
            })

            let classStyle2 = reactive({
                linedecoration:islinedecoration
            })
            // 转换为响应式
            // function getClass(){
            //     return {colordecroation:iscolordecroatio,linedecoration:islinedecoration}
            // }
            return {
                iscolordecroatio,
                islinedecoration,
                classStyle1,
                classStyle2
            }
        },
    })
    app.mount("#app")
</script>
</html>